package main

import (
	"context"
	"fmt"
	"github.com/bwmarrin/snowflake"
	"github.com/micro/go-micro/v2"
	"github.com/olivere/elastic/v7"
	"github.com/speps/go-hashids"
	"math"
)

func main() {

	micro.Client()

	v := float64(1) / float64(20);
	fmt.Print(int32(math.Ceil(v)))
	// 创建一个空的上下文
	ctx := context.Background()
	// 创建一个
	client, _ := elastic.NewClient(
		elastic.SetURL("http://203.195.200.40:9200/", "http://203.195.200.40:9201/", "http://203.195.200.40:9202/"),
	)
	exit, err := client.IndexExists("db_user").Do(ctx)
	fmt.Print(err)
	fmt.Print(exit)
	node, err := snowflake.NewNode(1)
	if err != nil {
		fmt.Print(err)
	}
	for i := 0; i < 10; i++ {
		fmt.Println(node.Generate())
	}
	hd := hashids.NewData()
	hd.Salt = "dashenwo"
	hd.MinLength = 24
	hd.Alphabet = "0123456789abcdef"
	h, _ := hashids.NewWithData(hd)
	id := int(node.Generate())
	e, _ := h.Encode([]int{id})
	fmt.Println(e)
	d, _ := h.DecodeWithError(e)
	fmt.Println(d[0])




}